from fastapi import APIRouter
from .knowledge_router import \
    show_knowledge_list, show_knowledge_file_list, \
    add_knowledge_base, delete_knowledge, update_knowledge_name, delete_file_from_kb, update_kb_group, \
    add_knowledge_files, list_knowledge_files_query, show_knowledge_list_all
from .recommend_router import recommend_questions, add_recommend_question, update_recommend_question, delete_recommend_question
from .prompt_router import update_prompt, read_prompt

router = APIRouter()


router.get("/knowledge/list_knowledge", tags=["Knowledge"], summary="列出所有知识库")(show_knowledge_list)
router.get("/knowledge/knowledges_all", tags=["Knowledge"], summary="列出所有知识库")(show_knowledge_list_all)
router.get("/knowledge/list_knowledge_files", tags=["Knowledge"], summary="列出所有知识库文件")(show_knowledge_file_list)
router.post("/knowledge/list_knowledge_files_query", tags=["Knowledge"], summary="条件检索知识库文件")(list_knowledge_files_query)

router.post("/knowledge/add_knowledge_files", tags=["Knowledge"], summary="关联文件和知识库")(add_knowledge_files)
router.post("/knowledge/add_knowledge", tags=["Knowledge"], summary="创建知识库")(add_knowledge_base)
router.put("/knowledge/update_knowledge_name", tags=["Knowledge"], summary="修改知识库名称")(update_knowledge_name)
router.delete("/knowledge/delete_knowledge", tags=["Knowledge"], summary="删除知识库")(delete_knowledge)
router.post("/knowledge/update_kb_group", tags=["Knowledge"], summary="更新知识库用户组")(update_kb_group)
router.post("/knowledge/delete_knowledge_files", tags=["Knowledge"], summary="删除指定知识库文件")(delete_file_from_kb)

router.get("/knowledge/recommend", tags=["Knowledge"], summary="推荐问题")(recommend_questions)
router.post("/knowledge/add_recommend_question", tags=["Knowledge"], summary="添加推荐问题")(add_recommend_question)
router.put("/knowledge/update_recommend_question", tags=["Knowledge"], summary="更新推荐问题")(update_recommend_question)
router.delete("/knowledge/delete_recommend_question", tags=["Knowledge"], summary="删除推荐问题")(delete_recommend_question)

router.put("/prompt/read", tags=['knowledge chat'], summary="读取Prompt")(read_prompt)
router.put("/prompt/update", tags=['knowledge chat'], summary="更新Prompt")(update_prompt)
# router.post("/knowledge/update_knowledge_file", tags=["Knowledge"], summary="解析指定文件")(file_parse)
